package cn.edu.lzzy.entities;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 审核业务实体
 */
@Entity
public class Applicant extends BasicEntity{
    @ManyToOne
    private User student;
    @ManyToOne
    private Course course;
    @Transient//不入库
    public static final int STATUS_APPLY=0;//申请
    @Transient
    public static final int STATUS_PASS=1;//通过
    @Transient
    public static final int STATUS_REFUSE=2;//拒绝
    private int status;//审核状态
    private Date applyTime;//审核时间

    public Applicant() {
    }
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }


    @JsonBackReference //Jackson序列化，由于Java允许循环引用，可能会存在递归调用，引起堆栈溢出，@JsonMangedReference
    public User getStudent() {
        return student;
    }

    public void setStudent(User student) {
        this.student = student;
    }
    @JsonBackReference
    public Course getCourse() {
        return course;
    }

    public void setCourse(Course course) {
        this.course = course;
    }

    public Date getApplyTime() {
        return applyTime;
    }

    public void setApplyTime(Date applyTime) {
        this.applyTime = applyTime;
    }

}
